﻿@model Gundong2
@{
    ViewBag.Title = "二级页面滚动图片编辑";
}
<form action='@Url.Action("Edit")' method="post"  class="editForm">
<div style="height: 40px; line-height: 40px; padding: 0 10px;">
    <div class="pull-left" style="height: 40px; line-height: 40px;">
        <h2 id="bigTitle">
            @ViewBag.Title
        </h2>
    </div>
</div>
<hr />
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        URL：
    </div>
    <div class="span11">
        @Html.TextBoxFor(x => x.Url)
    </div>
</div>
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        说明：
    </div>
    <div class="span11">
        @Html.TextAreaFor(x => x.Name, 5, 20, null)
    </div>
</div>
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        上传图片：
    </div>
    <div class="span11">
        <input type="file" name="file_upload" id="file_upload" />
        <div>
            图片尺寸： 1280px*180px</div>
        @Html.HiddenFor(x => x.Image)
        @if (!string.IsNullOrWhiteSpace(Model.Image))
        {
            <img id="mImg" src="~/file/gundong2/@Model.Image" />
        }
        else
        {
            <img id="mImg" />
        }
    </div>
</div>
@Html.ValidationSummary()
<div class="row" style="margin-top: 20px;">
    <div class="span2 offset3">
        <input type="submit" id="Button1" class="btn  btn-primary  btn-large" runat="server"
            onserverclick="Button1_Click" value="保存" />
    </div>
    <div class="span2">
        <a href="@Url.Action("List")" class="btn btn-info  btn-large"><i class="icon-th-list icon-white">
        </i>返回列表</a>
    </div>
</div>
</form>
@section scripts{
    <script type="text/javascript">
        $(function () {
            $('#file_upload').uploadify({
                'swf': '@Url.Content("~/Content/uploadify-v3.1/uploadify.swf")',
                'uploader': '@Url.Action("Index", "Image")',
                'buttonText': '选择图片...',
                'fileTypeExts': '*.gif; *.jpg; *.png',
                'onUploadSuccess': function (file, data, response) {
                    var json = $.parseJSON(data);
                    document.getElementById('mImg').src = '@Url.Content("~/file/temp/")' + json.name;
                    document.getElementById('Image').value = json.name;
                }
            });
        });
        
    </script>
}
